For now, I've been working a lot with Processing and Arduino, and even though I'd like to try to use the ESP8266, I'll leave it for the upcoming weeks. Mainly because I got stuck with Processing, trying to figure out the reason why it continually gave me an error with the code. I spent a lot of time figuring out the best way possible to use the RGB Sensor.
To begin using the Adafruit Sensor, I needed to download the library. I went to their webpage and followed the instructions to download the library - "Adafruit_TCS34725". Like many other libraries, I went into the menu in Arduino IDE, search for Sketch/Include Library / Manage Libraries, and searched for "Adafruit TCS34725." After installing the library. I needed to check if it worked correctly, so I ran it and printed the values to see if it was reading something. It did.
How accurate is it? The downloaded file in Arduino already had the code for Processing as a comment. One thing to highlight about it, is that it can't run with Processing 3+, only 1.5!!! So I had to download that version first and then try it, changed the Serial Port (to match it with the Arduino), and Run. The file opened a small window that showed the color read, and yes, it is not very accurate. When I put a black color on top of it, it showed more of a brownish-grey, and the white was sometimes a bit yellowish. Anyway, even with these errors, it worked. So it was time to try it with my code.
Here came the hard part. I wanted to use two sensors, the RGB and another, that could change parameters in the code. I decided to use the flex Sensor. Here, I decided to save some values that somehow disturbed my code in Arduino. So I kept the gamma table (which was created by PhilB and allowed to convert RGB colors to what humans see) as a separate library and then included it in the file as the others. After this, I added an extra variable, and established contact with it, calibrating and mapping te values given by it. But when opening the Serial Port, the values didn't print as expected. I had the flex sensor value, and then without any spacing, the RGB values.
I needed to read and analyze how the print function in the RGB Sensor, worked. I searched for examples on the internet and realized that it was easier to print a letter +: to separate the numbers. After doing it and changing the position of the RGB Sensor to follow the FlexSensor, the values started to appear right. First, the value given by the FlexSensor followed by the RGB. Now the problem was with Processing. It gave error every time I ran the code, didn't read the value from the sensor, and neither did it changed what I asked it. I cleared and rewrote the things I wanted as well as searched for solutions on the internet. I got it after a long, long, long while.
Still, I'd like to rethink how it's drawn, I tried changing the "v.normalize" and "v.multiply" (this I learned by watching Dan Shiffman's videos) but didn't get what wanted. I tried putting the flex sensor's values for the "v2" but didn't understand what wished to either. For now, this is what I got. Maybe I could add more sensors, and according to the one that changes values, Processing could draw rectangles, and if I change the sensor, it could start drawing ellipses, lines, or whatever other things.